package com.etonedu.meals.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

import io.objectbox.annotation.Convert;
import io.objectbox.annotation.Entity;
import io.objectbox.annotation.Id;

@Entity
public class StudentBean implements Parcelable {
    /**
     * className : 高二（1）班
     * relUserPhotos :
     * roleType : 1
     * url : https://file.52ess.cn/group01/M00/01/A3/rBJsQl1s5MGEYXYoAAAAAOHzHVE375.jpg
     * userId : alFGUTY5S0N0WGRQT2RKLzJodzRKdz09
     * userName : 陈羿羽
     */

    @Id
    private Long id;
    private String className;
    private String relUserPhotos;
    private int roleType;
    private String url;
    private String userId;
    private String userName;
    private String cardNo;
    private int isCard;
    private int cardFlag; // 0 打卡成功 1 非法卡号 2 不在本班级
    private String noDiscernCard;
    @Convert(converter = StringConverter.class,dbType = String.class)
    private List<String> cardNos;
    private int isClass;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getRelUserPhotos() {
        return relUserPhotos;
    }

    public void setRelUserPhotos(String relUserPhotos) {
        this.relUserPhotos = relUserPhotos;
    }

    public int getRoleType() {
        return roleType;
    }

    public void setRoleType(int roleType) {
        this.roleType = roleType;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public int getIsCard() {
        return isCard;
    }

    public void setIsCard(int isCard) {
        this.isCard = isCard;
    }

    public int getCardFlag() {
        return cardFlag;
    }

    public void setCardFlag(int cardFlag) {
        this.cardFlag = cardFlag;
    }

    public String getNoDiscernCard() {
        return noDiscernCard;
    }

    public void setNoDiscernCard(String noDiscernCard) {
        this.noDiscernCard = noDiscernCard;
    }

    public List<String> getCardNos() {
        return cardNos;
    }

    public void setCardNos(List<String> cardNos) {
        this.cardNos = cardNos;
    }

    public int getIsClass() {
        return isClass;
    }

    public void setIsClass(int isClass) {
        this.isClass = isClass;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.id);
        dest.writeString(this.className);
        dest.writeString(this.relUserPhotos);
        dest.writeInt(this.roleType);
        dest.writeString(this.url);
        dest.writeString(this.userId);
        dest.writeString(this.userName);
        dest.writeString(this.cardNo);
        dest.writeInt(this.isCard);
        dest.writeInt(this.cardFlag);
        dest.writeString(this.noDiscernCard);
        dest.writeStringList(this.cardNos);
        dest.writeInt(this.isClass);
    }

    public StudentBean() {
    }

    protected StudentBean(Parcel in) {
        this.id = (Long) in.readValue(Long.class.getClassLoader());
        this.className = in.readString();
        this.relUserPhotos = in.readString();
        this.roleType = in.readInt();
        this.url = in.readString();
        this.userId = in.readString();
        this.userName = in.readString();
        this.cardNo = in.readString();
        this.isCard = in.readInt();
        this.cardFlag = in.readInt();
        this.noDiscernCard = in.readString();
        this.cardNos = in.createStringArrayList();
        this.isClass = in.readInt();
    }

    public static final Creator<StudentBean> CREATOR = new Creator<StudentBean>() {
        @Override
        public StudentBean createFromParcel(Parcel source) {
            return new StudentBean(source);
        }

        @Override
        public StudentBean[] newArray(int size) {
            return new StudentBean[size];
        }
    };
}
